package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    /**
     * 根据菜品id查询套餐id
     * @param dishIds
     * @return
     */

    List<Long> getSetmealIdsByDishIds(List<Long> dishIds);

    /**
     * 批量插入套餐中菜品
     * @param dishes
     */
    void insertBatch(List<SetmealDish> dishes);

    /**
     * 批量删除套餐中的菜品
     * @param setmealIds
     */
    void deleteById(List<Long> setmealIds);

    /**
     * 查询一个套餐中所有菜品的id
     * @param ids
     * @return
     */
    @Select("select dish_id from setmeal_dish where setmeal_id = #{id}")
    List<Long> getDishIDBysetmealId(Long id);




    /**
     * 查询套餐中菜品（根据套餐id)
     * @return
     */
    List<SetmealDish> getById(Long setmealDishID);

    /**
     * 删除套餐菜品
     * @param id
     */
    @Delete("delete from setmeal_dish where setmeal_id = #{id}")
    void deleteBySetmealId(Long id);
}
